#pragma once

#include <sys_def.h>

// APB2寄存器第0到7位的定义
typedef struct {
	u8_s AFIO : 1;
	u8_s : 1;
	u8_s GPIOA : 1;
	u8_s GPIOB : 1;
	u8_s GPIOC : 1;
	u8_s GPIOD : 1;
	u8_s GPIOE : 1;
	u8_s : 1;
} rcu_apb2_0_7_s;

_Static_assert(sizeof(rcu_apb2_0_7_s) == 1,
	       "Struct rcu_apb2_0_s defined error!");

// APB2型寄存器第8到15位的定义
typedef struct {
	u8_s : 1;
	u8_s ADC0 : 1;
	u8_s ADC1 : 1;
	u8_s TIMER0 : 1;
	u8_s SPI0 : 1;
	u8_s : 1;
	u8_s USART0 : 1;
	u8_s : 1;
} rcu_apb2_8_15_s;

_Static_assert(sizeof(rcu_apb2_8_15_s) == 1,
	       "Struct rcu_apb2_1_s defined error!");

// APB2型寄存器第0到15位的定义
typedef struct {
	rcu_apb2_0_7_s apb2_0_7;
	rcu_apb2_8_15_s apb2_8_15;
} __attribute__((aligned(2))) rcu_apb2_s;

_Static_assert(sizeof(rcu_apb2_s) == 2, "Struct rcu_apb2_s defined error!");
